find_package(Gettext REQUIRED)

set(LANG "ru")
set(LANG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${LANG}/${PROJECT_NAME}.po")
set(TARGET_LANG_FILE ${PROJECT_NAME}.mo)
add_custom_command(
  OUTPUT ${TARGET_LANG_FILE}
  COMMAND ${GETTEXT_MSGFMT_EXECUTABLE}
  ARGS ${LANG_FILE} -o ${TARGET_LANG_FILE}
  DEPENDS ${LANG_FILE}
)

add_custom_target(lang SOURCES ${LANG_FILE} DEPENDS ${TARGET_LANG_FILE})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_LANG_FILE} DESTINATION
  share/locale/ru/LC_MESSAGES)
